#pragma once
#include "DXAMLCommon.h"
#include "CReferenceCount.h"
#include "Typography.h"
#include "TextOptions.h"

class CDependencyObject;
class CDependencyProperty;
class CValue;

struct Typography;

class InheritedProperties :
	public CReferenceCount
{

private: 
	XUINT32 Release();
public: 
	void DisconnectFrom(CDependencyObject * pFrom);
	static void ReleaseFromNonDependencyObject(InheritedProperties * * ppInheritedProperties);
	static void ReleaseFromNonDependencyObject(const InheritedProperties * * ppInheritedProperties);
	static HRESULT CreateCopy(CDependencyObject * pWriter, InheritedProperties * pTemplate, InheritedProperties * * ppInheritedProperties);
	static HRESULT CreateDefault(CCoreServices * pCore, InheritedProperties * * ppDefaultInheritedProperties);
	static HRESULT GetDefaultValue(XUINT32 userIndex, CValue * pDefaultValue);
	void SetPropertyFlag(CDependencyProperty * pDp, enum InheritedPropertyFlag flag, XUINT32 fState);
	XBOOL IsPropertyFlagSet(CDependencyProperty * pDp, enum InheritedPropertyFlag flag);
	HRESULT CopyNonLocallySetProperties(const InheritedProperties * pOther);
	static CDependencyProperty * GetCorrespondingInheritedProperty(CDependencyObject * pdo, CDependencyProperty * pdp);
	XBOOL IsOld();
	void SetIsUpToDate();
	static void RecordTextPropertyUsage(CDependencyObject * pDo);
	static void RecordNoopEnsureTextFormatting();
	static void RecordUpdateEnsureTextFormatting();
	static void RecordCreationEnsureTextFormatting();
	static void RecordPulledEnsureTextFormatting();
	static void TraceDependencyObjectTextPropertyUsage();
	XUINT32 * m_pCoreInheritedPropGenerationCounter;
	XUINT32 m_cGenerationCounter;
	CDependencyObject * m_pWriter;
	struct Typography m_typography;
	
	struct TextOptions m_textOptions;

private: 
	XUINT64 m_fIsSetLocally;
	XUINT64 m_fIsSetByStyle;
	XUINT64 m_fHasStyleBinding;
	InheritedProperties(CCoreServices *);
	InheritedProperties();
	virtual ~InheritedProperties();
};
